using System;
using System.Collections.Generic;
using System.Text;

namespace Zsa.Emulation.Processor
{
 
    /// <summary>
    /// The interrupt types.
    /// </summary>
    public enum InterruptType 
    {
        Unknown = 0,
        /// <summary>
        /// Reset interrupt.  Happens when console is turned on.
        /// </summary>
        Reset = 65532,
        /// <summary>
        /// N maskable interrupt.
        /// Used to draw a scan line.  A number of these occur depending on 
        /// the pal or ntsc.
        /// </summary>
        Nmi = 0xFFFA,
        /// <summary>
        /// Address for break interrupt.
        /// </summary>
        Break = 65534
                
    }


    /// <summary>
    /// The cpu status register flags.
    /// </summary>
    [Flags()]
    public enum StatusRegisterFlags : byte
    {
        None,
        /// <summary>
        /// Used to create to extend a number by an additional 
        /// bit creating a 9 bit number.
        /// </summary>
        CarryFlag = 1,
        /// <summary>
        /// Indicates the result is zero.
        /// </summary>
        ZeroFlag = 2,
        /// <summary>
        /// Indicates thats interrupts are disabled.
        /// </summary>
        InterruptFlag = 4,
        /// <summary>
        /// Not used.
        /// </summary>
        Decimal = 8,
        /// <summary>
        /// Indicates a break interrupt.
        /// </summary>
        Break = 16,
        /// <summary>
        /// Not used.
        /// </summary>
        Reserved = 32,
        /// <summary>
        /// Indicates overflow.
        /// </summary>
        Overflow = 64,
        /// <summary>
        /// Indicates the number is negative or sing
        /// </summary>
        Sign = 128

    }



    /// <summary>
    /// 
    /// </summary>
    /// <remarks>
    /// when op = aaabbbcc 
    /// bbb	addressing mode   
    /// </remarks>
    public enum MemoryAddressingType
    {
        /// <summary>
        /// Indicates memory read via zero page x.
        /// adr = b1 + 0x100 + regX
        /// data = read(adr);
        /// </summary>
        ZeroPageX = 0,

        /// <summary>
        /// Indicates the memory read via zeropage.
        /// adr = b1 + 0x100
        /// data = read(adr);
        /// </summary>
        ZeroPage = 1,

        /// <summary>
        /// Indicates the data is write after the op
        /// data = b1;
        /// </summary>
        Immediate = 2,

        /// <summary>
        /// Indicates the data is at the absolute address.
        /// adr = (b1 | (b2 rshift 8))
        /// data = read(adr);
        /// </summary>
        Absolute = 3,

        /// <summary>
        /// Indicates the data is at the indirect address.
        /// adr = (b1)
        /// adr = read(adr) | (read(adr) rshift 8)
        /// data = read(adr + regY);
        /// </summary>
        IndirectY = 4,

        /// <summary>
        /// Indicates the data is at the indirect address.
        /// adr = (b1 + regX)
        /// adr = read(adr) | (read(adr) rshift 8)
        /// data = read(adr);
        /// </summary>
        IndirectX = 5,

        /// <summary>
        /// Indicates the data is at the absolute address.
        /// adr = (b1 | (b2 rshift 8))
        /// data = read(adr + regY);
        /// </summary>
        AbsoluteY = 6,

        /// <summary>
        /// Indicates the data is at the absolute address.
        /// adr = (b1 | (b2 rshift 8))
        /// data = read(adr + regX);
        /// </summary>
        AbsoluteX = 7,

        /// <summary>
        /// All the bits.
        /// </summary>
        AllBits = 4 | 8 | 16
    }


    /// <summary>
    /// The 6502 processor op codes.
    /// </summary>
    public enum OpCodes : byte
    {
        /// <summary>
        /// Force Break
        /// </summary>
        BRK = 0x00,
        /// <summary>
        /// "OR" Memory with Accumulator
        /// </summary>
        ORA_IX = 0x01,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_02 = 0x02,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_03 = 0x03,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_04 = 0x04,
        /// <summary>
        /// "OR" Memory with Accumulator
        /// </summary>
        ORA_Z = 0x05,
        /// <summary>
        /// Shift Left One Bit (Memory or Accumulator)
        /// </summary>
        ASL_Z = 0x06,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_07 = 0x07,
        /// <summary>
        /// Push Processor Status on Stack
        /// </summary>
        PHP = 0x08,
        /// <summary>
        /// "OR" Memory with Accumulator
        /// </summary>
        ORA = 0x09,
        /// <summary>
        /// Shift Left One Bit (Memory or Accumulator)
        /// </summary>
        ASL_ACC = 0x0A,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_0B = 0x0B,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_0C = 0x0C,
        /// <summary>
        /// "OR" Memory with Accumulator
        /// </summary>
        ORA_A = 0x0D,
        /// <summary>
        /// Shift Left One Bit (Memory or Accumulator)
        /// </summary>
        ASL_A = 0x0E,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_0F = 0x0F,
        /// <summary>
        /// Branch on Result Plus
        /// </summary>
        BPL = 0x10,
        /// <summary>
        /// "OR" Memory with Accumulator
        /// </summary>
        ORA_IY = 0x11,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_12 = 0x12,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_13 = 0x13,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_14 = 0x14,
        /// <summary>
        /// "OR" Memory with Accumulator
        /// </summary>
        ORA_ZX = 0x15,
        /// <summary>
        /// Shift Left One Bit (Memory or Accumulator)
        /// </summary>
        ASL_ZX = 0x16,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_17 = 0x17,
        /// <summary>
        /// Clear Carry Flag
        /// </summary>
        CLC = 0x18,
        /// <summary>
        /// "OR" Memory with Accumulator
        /// </summary>
        ORA_AY = 0x19,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_1A = 0x1A,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_1B = 0x1B,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_1C = 0x1C,
        /// <summary>
        /// "OR" Memory with Accumulator
        /// </summary>
        ORA_AX = 0x1D,
        /// <summary>
        /// Shift Left One Bit (Memory or Accumulator)
        /// </summary>
        ASL_AX = 0x1E,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_1F = 0x1F,
        /// <summary>
        /// Jump to New Location Saving Return Address
        /// </summary>
        JSR = 0x20,
        /// <summary>
        /// "AND" Memory with Accumulator
        /// </summary>
        AND_IX = 0x21,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_22 = 0x22,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_23 = 0x23,
        /// <summary>
        /// Test Bits in Memory with Accumulator
        /// </summary>
        BIT_Z = 0x24,
        /// <summary>
        /// "AND" Memory with Accumulator
        /// </summary>
        AND_Z = 0x25,
        /// <summary>
        /// Rotate One Bit Left (Memory or Accumulator)
        /// </summary>
        ROL_Z = 0x26,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_27 = 0x27,
        /// <summary>
        /// Pull Processor Status from Stack
        /// </summary>
        PLP = 0x28,
        /// <summary>
        /// "AND" Memory with Accumulator
        /// </summary>
        AND = 0x29,
        /// <summary>
        /// Rotate One Bit Left (Memory or Accumulator)
        /// </summary>
        ROL_ACC = 0x2A,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_2B = 0x2B,
        /// <summary>
        /// Test Bits in Memory with Accumulator
        /// </summary>
        BIT_A = 0x2C,
        /// <summary>
        /// "AND" Memory with Accumulator
        /// </summary>
        AND_A = 0x2D,
        /// <summary>
        /// Rotate One Bit Left (Memory or Accumulator)
        /// </summary>
        ROL_A = 0x2E,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_2F = 0x2F,
        /// <summary>
        /// Branch on Result Minus
        /// </summary>
        BMI = 0x30,
        /// <summary>
        /// "AND" Memory with Accumulator
        /// </summary>
        AND_IY = 0x31,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_32 = 0x32,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_33 = 0x33,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_34 = 0x34,
        /// <summary>
        /// "AND" Memory with Accumulator
        /// </summary>
        AND_ZX = 0x35,
        /// <summary>
        /// Rotate One Bit Left (Memory or Accumulator)
        /// </summary>
        ROL_ZX = 0x36,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_37 = 0x37,
        /// <summary>
        /// Set Carry Flag 
        /// </summary>
        SEC = 0x38,
        /// <summary>
        /// "AND" Memory with Accumulator
        /// </summary>
        AND_AY = 0x39,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_3A = 0x3A,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_3B = 0x3B,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_3C = 0x3C,
        /// <summary>
        /// "AND" Memory with Accumulator
        /// </summary>
        AND_AX = 0x3D,
        /// <summary>
        /// Rotate One Bit Left (Memory or Accumulator)
        /// </summary>
        ROL_AX = 0x3E,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_3F = 0x3F,
        /// <summary>
        /// Return from Interrupt
        /// </summary>
        RTI = 0x40,
        /// <summary>
        /// "Exclusive-Or" Memory with Accumulator
        /// </summary>
        EOR_IX = 0x41,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_42 = 0x42,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_43 = 0x43,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_44 = 0x44,
        /// <summary>
        /// "Exclusive-Or" Memory with Accumulator
        /// </summary>
        EOR_Z = 0x45,
        /// <summary>
        /// Shift Right One Bit (Memory or Accumulator)
        /// </summary>
        LSR_Z = 0x46,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_47 = 0x47,
        /// <summary>
        /// Push Accumulator on Stack
        /// </summary>
        PHA = 0x48,
        /// <summary>
        /// "Exclusive-Or" Memory with Accumulator
        /// </summary>
        EOR = 0x49,
        /// <summary>
        /// Shift Right One Bit (Memory or Accumulator)
        /// </summary>
        LSR_ACC = 0x4A,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_4B = 0x4B,
        /// <summary>
        /// Jump to New Location
        /// </summary>
        JMP_A = 0x4C,
        /// <summary>
        /// "Exclusive-Or" Memory with Accumulator
        /// </summary>
        EOR_A = 0x4D,
        /// <summary>
        /// Shift Right One Bit (Memory or Accumulator)
        /// </summary>
        LSR_A = 0x4E,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_4F = 0x4F,
        /// <summary>
        /// Branch on Overflow Clear
        /// </summary>
        BVC = 0x50,
        /// <summary>
        /// "Exclusive-Or" Memory with Accumulator
        /// </summary>
        EOR_IY = 0x51,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_52 = 0x52,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_53 = 0x53,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_54 = 0x54,
        /// <summary>
        /// "Exclusive-Or" Memory with Accumulator
        /// </summary>
        EOR_ZX = 0x55,
        /// <summary>
        /// Shift Right One Bit (Memory or Accumulator)
        /// </summary>
        LSR_ZX = 0x56,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_57 = 0x57,
        /// <summary>
        /// Clear interrupt Disable Bit
        /// </summary>
        CLI = 0x58,
        /// <summary>
        /// "Exclusive-Or" Memory with Accumulator
        /// </summary>
        EOR_AY = 0x59,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_5A = 0x5A,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_5B = 0x5B,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_5C = 0x5C,
        /// <summary>
        /// Shift Right One Bit (Memory or Accumulator)
        /// </summary>
        LSR_AX = 0x5E,
        /// <summary>
        /// "Exclusive-Or" Memory with Accumulator
        /// </summary>
        EOR_AX = 0x5D,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_5F = 0x5F,
        /// <summary>
        /// Return from Subroutine
        /// </summary>
        RTS = 0x60,
        /// <summary>
        /// Add Memory to Accumulator with Carry
        /// </summary>
        ADC_IX = 0x61,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_62 = 0x62,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_63 = 0x63,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_64 = 0x64,
        /// <summary>
        /// Add Memory to Accumulator with Carry
        /// </summary>
        ADC_Z = 0x65,
        /// <summary>
        /// Rotate One Bit Right (Memory or Accumulator)
        /// </summary>
        ROR_Z = 0x66,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_67 = 0x67,
        /// <summary>
        /// Pull Accumulator from Stack
        /// </summary>
        PLA = 0x68,
        /// <summary>
        /// Add Memory to Accumulator with Carry.
        /// Immediate Addressing Mode.
        /// </summary>
        ADC = 0x69,
        /// <summary>
        /// Rotate One Bit Right (Memory or Accumulator)
        /// </summary>
        ROR_ACC = 0x6A,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_6B = 0x6B,
        /// <summary>
        /// Jump to New Location
        /// </summary>
        JMP_I = 0x6C,
        /// <summary>
        /// Add Memory to Accumulator with Carry.
        /// Absolute.  The next two bytes flipped are the address of the operand.
        /// </summary>
        ADC_A = 0x6D,
        /// <summary>
        /// Rotate One Bit Right (Memory or Accumulator)
        /// </summary>
        ROR_A = 0x6E,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_6F = 0x6F,
        /// <summary>
        /// Branch on Overflow Set or Add Memory to Accumulator with Carry
        /// </summary>
        BVS = 0x70,
        /// <summary>
        /// Add Memory to Accumulator with Carry
        /// </summary>
        ADC_IY = 0x71,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_72 = 0x72,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_73 = 0x73,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_74 = 0x74,
        /// <summary>
        /// Add Memory to Accumulator with Carry
        /// </summary>
        ADC_ZX = 0x75,
        /// <summary>
        /// Rotate One Bit Right (Memory or Accumulator)
        /// </summary>
        ROR_ZX = 0x76,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_77 = 0x77,
        /// <summary>
        /// Set Interrupt Disable Status 
        /// </summary>
        SEI = 0x78,
        /// <summary>
        /// Add Memory to Accumulator with Carry.
        /// Absolute.  The next two bytes flipped are the address of the operand.
        /// Add the y register to the address.
        /// </summary>
        ADC_AY = 0x79,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_7A = 0x7A,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_7B = 0x7B,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_7C = 0x7C,
        /// <summary>
        /// Add Memory to Accumulator with Carry.
        /// Absolute.  The next two bytes flipped are the address of the operand.
        /// Add the x register to the address.
        /// </summary>
        ADC_AX = 0x7D,
        /// <summary>
        /// Rotate One Bit Right (Memory or Accumulator)
        /// </summary>
        ROR_AX = 0x7E,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_7F = 0x7F,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_80 = 0x80,
        /// <summary>
        /// Store Accumulator in Memory 
        /// </summary>
        STA_A = 0x8D,
        /// <summary>
        /// Store Accumulator in Memory 
        /// </summary>
        STA_IX = 0x81,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_82 = 0x82,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_83 = 0x83,
        /// <summary>
        /// Store Index Y in Memory
        /// </summary>
        STY_Z = 0x84,
        /// <summary>
        /// Store Accumulator in Memory 
        /// </summary>
        STA_Z = 0x85,
        /// <summary>
        /// Store Index X in Memory
        /// </summary>
        STX_Z = 0x86,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_87 = 0x87,
        /// <summary>
        /// Decrement Index Y by One
        /// </summary>
        DEY = 0x88,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_89 = 0x89,
        /// <summary>
        /// Transfer Index X to Accumulator
        /// </summary>
        TXA = 0x8A,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_8B = 0x8B,
        /// <summary>
        /// Store Index Y in Memory
        /// </summary>
        STY_A = 0x8C,
        /// <summary>
        /// Store Accumulator in Memory.
        /// Absolute
        /// </summary>
        STA = 0x8D,
        /// <summary>
        /// Store Index X in Memory
        /// </summary>
        STX_A = 0x8E,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_8F = 0x8F,
        /// <summary>
        /// Branch on Carry Clear and 
        /// Store Accumulator in Memory
        /// </summary>
        BCC = 0x90,
        /// <summary>
        /// Store Accumulator in Memory 
        /// </summary>
        STA_IY = 0x91,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_92 = 0x92,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_93 = 0x93,
        /// <summary>
        /// Store Index Y in Memory
        /// </summary>
        STY_ZX = 0x94,
        /// <summary>
        /// Store Accumulator in Memory 
        /// </summary>
        STA_ZX = 0x95,
        /// <summary>
        /// Store Index X in Memory
        /// </summary>
        STX_ZY = 0x96,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_97 = 0x97,
        /// <summary>
        /// Transfer Index Y to Accumulator
        /// </summary>
        TYA = 0x98,
        /// <summary>
        /// Store Accumulator in Memory 
        /// </summary>
        STA_AY = 0x99,
        /// <summary>
        /// Transfer Index X to Stack Pointer 
        /// </summary>
        TXS = 0x9A,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_9B = 0x9B,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_9C = 0x9C,
        /// <summary>
        /// Store Accumulator in Memory
        /// </summary>
        STA_AX = 0x9D,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_9E = 0x9E,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_9F = 0x9F,
        /// <summary>
        /// Load Index Y with Memory
        /// </summary>
        LDY = 0xA0,
        /// <summary>
        /// Load Accumulator with Memory
        /// </summary>
        LDA_IX = 0xA1,
        /// <summary>
        /// Load Index X with Memory
        /// </summary>
        LDX = 0xA2,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_A3 = 0xA3,
        /// <summary>
        /// Load Index Y with Memory
        /// </summary>
        LDY_Z = 0xA4,
        /// <summary>
        /// Load Accumulator with Memory
        /// </summary>
        LDA_Z = 0xA5,
        /// <summary>
        /// Load Index X with Memory
        /// </summary>
        LDX_Z = 0xA6,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_A7 = 0xA7,
        /// <summary>
        /// Transfer Accumulator to Index Y
        /// </summary>
        TAY = 0xA8,
        /// <summary>
        /// Load Accumulator with Memory
        /// </summary>
        LDA = 0xA9,
        /// <summary>
        /// Transfer Accumulator to Index X
        /// </summary>
        TAX = 0xAA,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_AB = 0xAB,
        /// <summary>
        /// Load Index Y with Memory
        /// </summary>
        LDY_A = 0xAC,
        /// <summary>
        /// Load Accumulator with Memory
        /// </summary>
        LDA_A = 0xAD,
        /// <summary>
        /// Load Index X with Memory
        /// </summary>
        LDX_A = 0xAE,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_AF = 0xAF,
        /// <summary>
        /// Branch on Carry Set
        /// </summary>
        BCS = 0xB0,
        /// <summary>
        /// Load Accumulator with Memory
        /// </summary>
        LDA_IY = 0xB1,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_B2 = 0xB2,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_B3 = 0xB3,
        /// <summary>
        /// Load Index Y with Memory
        /// </summary>
        LDY_ZX = 0xB4,
        /// <summary>
        /// Load Accumulator with Memory
        /// </summary>
        LDA_ZX = 0xB5,
        /// <summary>
        /// Load Index X with Memory
        /// </summary>
        LDX_ZY = 0xB6,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_B7 = 0xB7,
        /// <summary>
        /// Clear Overflow Flag
        /// </summary>
        CLV = 0xB8,
        /// <summary>
        /// Load Accumulator with Memory
        /// </summary>
        LDA_AY = 0xB9,
        /// <summary>
        /// Transfer Stack Pointer to Index X
        /// </summary>
        TSX = 0xBA,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_BB = 0xBB,
        /// <summary>
        /// Load Index Y with Memory
        /// </summary>
        LDY_AX = 0xBC,
        /// <summary>
        /// Load Accumulator with Memory
        /// </summary>
        LDA_AX = 0xBD,
        /// <summary>
        /// Load Index X with Memory
        /// </summary>
        LDX_AY = 0xBE,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_BF = 0xBF,
        /// <summary>
        /// Compare Memory and Index Y
        /// </summary>
        CPY = 0xC0,
        /// <summary>
        /// Compare Memory and Accumulator
        /// </summary>
        CMP_IX = 0xC1,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_C2 = 0xC2,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_C3 = 0xC3,
        /// <summary>
        /// Compare Memory and Index Y
        /// </summary>
        CPY_Z = 0xC4,
        /// <summary>
        /// Compare Memory and Accumulator
        /// </summary>
        CMP_Z = 0xC5,
        /// <summary>
        /// Decrement Memory by One
        /// </summary>
        DEC_Z = 0xC6,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_C7 = 0xC7,
        /// <summary>
        /// Increment Index Y by One
        /// </summary>
        INY = 0xC8,
        /// <summary>
        /// Compare Memory and Accumulator
        /// </summary>
        CMP = 0xC9,
        /// <summary>
        /// Decrement Index X by One
        /// </summary>
        DEX = 0xCA,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_CB = 0xCB,
        /// <summary>
        /// Compare Memory and Index Y
        /// </summary>
        CPY_A = 0xCC,
        /// <summary>
        /// Compare Memory and Accumulator
        /// </summary>
        CMP_A = 0xCD,
        /// <summary>
        /// Decrement Memory by One
        /// </summary>
        DEC_A = 0xCE,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_CF = 0xCF,
        /// <summary>
        /// Branch on Result not Zero
        /// </summary>
        BNE = 0xD0,
        /// <summary>
        /// Compare Memory and Accumulator
        /// </summary>
        CMP_IY = 0xD1,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_D2 = 0xD2,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_D3 = 0xD3,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_D4 = 0xD4,
        /// <summary>
        /// Compare Memory and Accumulator
        /// </summary>
        CMP_ZX = 0xD5,
        /// <summary>
        /// Decrement Memory by One
        /// </summary>
        DEC_ZX = 0xD6,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_D7 = 0xD7,
        /// <summary>
        /// Clear Decimal Mode
        /// </summary>
        CLD = 0xD8,
        /// <summary>
        /// Compare Memory and Accumulator
        /// </summary>
        CMP_AY = 0xD9,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_DA = 0xDA,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_DB = 0xDB,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_DC = 0xDC,
        /// <summary>
        /// Compare Memory and Accumulator
        /// </summary>
        CMP_AX = 0xDD,
        /// <summary>
        /// Decrement Memory by One
        /// </summary>
        DEC_AX = 0xDE,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_DF = 0xDF,
        /// <summary>
        /// Compare Memory and Index X
        /// </summary>
        CPX = 0xE0,
        /// <summary>
        /// Subtract Memory from Accumulator with Borrow
        /// </summary>
        SBC_IX = 0xE1,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_E2 = 0xE2,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_E3 = 0xE3,
        /// <summary>
        /// Compare Memory and Index X
        /// </summary>
        CPX_Z = 0xE4,
        /// <summary>
        /// Subtract Memory from Accumulator with Borrow
        /// </summary>
        SBC_Z = 0xE5,
        /// <summary>
        /// Increment Memory by One
        /// </summary>
        INC_Z = 0xE6,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_E7 = 0xE7,
        /// <summary>
        /// Increment Index X by One
        /// </summary>
        INX = 0xE8,
        /// <summary>
        /// Subtract Memory from Accumulator with Borrow
        /// </summary>
        SBC = 0xE9,
        /// <summary>
        /// No Operation
        /// </summary>
        NOP = 0xEA,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_EB = 0xEB,
        /// <summary>
        /// Compare Memory and Index X
        /// </summary>
        CPX_A = 0xEC,
        /// <summary>
        /// Subtract Memory from Accumulator with Borrow
        /// </summary>
        SBC_A = 0xED,
        /// <summary>
        /// Increment Memory by One
        /// </summary>
        INC_A = 0xEE,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_EF = 0xEF,
        /// <summary>
        /// Branch on Result Zero
        /// </summary>
        BEQ = 0xF0,
        /// <summary>
        /// Subtract Memory from Accumulator with Borrow
        /// </summary>
        SBC_IY = 0xF1,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_F2 = 0xF2,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_F3 = 0xF3,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_F4 = 0xF4,
        /// <summary>
        /// Subtract Memory from Accumulator with Borrow
        /// </summary>
        SBC_ZX = 0xF5,
        /// <summary>
        /// Increment Memory by One
        /// </summary>
        INC_ZX = 0xF6,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_F7 = 0xF7,
        /// <summary>
        /// Set Decimal Mode
        /// </summary>
        SED = 0xF8,
        /// <summary>
        /// Subtract Memory from Accumulator with Borrow
        /// </summary>
        SBC_AY = 0xF9,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_FA = 0xFA,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_FB = 0xFB,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_FC = 0xFC,
        /// <summary>
        /// Subtract Memory from Accumulator with Borrow
        /// </summary>
        SBC_AX = 0xFD,
        /// <summary>
        /// Increment Memory by One
        /// </summary>
        INC_AX = 0xFE,
        /// <summary>
        /// Reserved and not used.
        /// </summary>
        RESERVED_FF = 0xFF

    }
}
